<?php
class ModelCataloghotrotructuyen extends Model {
	public function gethotrotructuyen($hotrotructuyen_id) {
		$query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "hotrotructuyen i LEFT JOIN " . DB_PREFIX . "hotrotructuyen_description id ON (i.hotrotructuyen_id = id.hotrotructuyen_id) WHERE i.hotrotructuyen_id = '" . (int)$hotrotructuyen_id . "' AND id.language_id = '" . (int)$this->config->get('config_language_id') . "'");
	
		return $query->row;
	}
	
	public function gethotrotructuyens() {
		$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "hotrotructuyen i LEFT JOIN " . DB_PREFIX . "hotrotructuyen_description id ON (i.hotrotructuyen_id = id.hotrotructuyen_id) WHERE id.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY i.sort_order ASC");
	
		return $query->rows;
	}
	public function gethotrotructuyenbydanhmuchotro($danhmuchotro_id) {
		$sql = "SELECT * FROM " . DB_PREFIX . "hotrotructuyen h LEFT JOIN " . DB_PREFIX . "hotrotructuyen_description hd ON (h.hotrotructuyen_id = hd.hotrotructuyen_id) WHERE hd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND h.danhmuchotro_id ='" . (int)$danhmuchotro_id . "' ORDER BY h.sort_order ASC";
		$query = $this->db->query($sql);
		
		//echo "<pre>";print_r($sql);die();

		return $query->rows;
	}
}
?>